cmake_minimum_required(VERSION 3.7)


project(blog-server)

link_libraries(rt pthread)
add_compile_options(-std=c++20)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--unresolved-symbols=ignore-in-shared-libs")

if(NOT CMAKE_BUILD_TYPE)
    SET(CMAKE_BUILD_TYPE "Release")
endif()

# 设置基础编译选项
SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} -Wall -Wextra -Werror -Wconversion -Wno-unused-parameter -Wold-style-cast -Woverloaded-virtual -Wpointer-arith -Wshadow -Wwrite-strings")

# 设置各构建类型的特定选项
SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -g")

SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)

#link_directories("/workspace/J3/AppSDK/appuser/lib/hbmedia")
#link_directories("/opt/J3/PlatformSDK_210602/AppSDK/appuser/lib")
#link_directories("/opt/J3/PlatformSDK_210602/AppSDK/appuser/lib/hbmedia")

file(GLOB_RECURSE SOURCEFILES
    ${PROJECT_SOURCE_DIR}/src/*.c*
    )
file(GLOB_RECURSE HEADERFILES
    ${PROJECT_SOURCE_DIR}/src/*.h
    )

include_directories(
    ${PROJECT_SOURCE_DIR}
    ${PROJECT_SOURCE_DIR}/src/third_party/glog/include
    ${PROJECT_SOURCE_DIR}/src/third_party/cereal/include
    )

link_directories(
  ${PROJECT_SOURCE_DIR}/src/third_party/glog/lib
)

add_executable(${PROJECT_NAME} ${SOURCEFILES} ${HEADERFILES})


target_link_libraries(${PROJECT_NAME}
  glog
)
